package com.quartz.controller;

/**
 * @author 袁嘉乐-tram
 * * @date 2022/7/4
 */

import com.quartz.jobModel.JobVo;
import com.quartz.listener.QuartzUtilToSaveListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;

import java.util.*;
/**
 * @author 袁嘉乐-tram
 * * @date 2022/7/4
 */

@RestController
@RequestMapping("/api.order/")
public class QuartzOrderController {

    @Autowired
    QuartzUtilToSaveListener quartzUtilToSaveListener;

    @Autowired
    RedisTemplate redisTemplate;

    @PostMapping("quartz")
    public void saveJob(@RequestBody JobVo jobVo ,@RequestParam  Map<String,Object> params){
        System.out.println(jobVo+"\n"+params);
        quartzUtilToSaveListener.saveJob(jobVo,params);
    }

    @DeleteMapping("dequartz")
    public void deJob(@RequestBody JobVo jobVo ){
        quartzUtilToSaveListener.removeJob(jobVo);
    }



}
